package com.ruoyi.fztz.kthzb.service.impl;

import com.ruoyi.fztz.clxhtb.domain.Clxhtb;
import com.ruoyi.fztz.kthzb.mapper.KthzMapper;
import com.ruoyi.fztz.kthzb.service.IKthzService;
import com.ruoyi.fztz.kthzb.vo.KthzVo;
import com.ruoyi.fztz.zzzecx.mapper.ZzzeMapper;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

/**
 * 课题汇总Service业务层处理
 *
 * @author huacai
 * @date 2024-11-27
 */
@Service
public class KthzServiceImpl implements IKthzService {
    @Resource
    private KthzMapper kthzMapper;

    @Resource
    private SqlSessionFactory sqlSessionFactory;

    /**
     * 查询课题汇总表列表
     * @param kthzVo 课题汇总Vo
     * @return 课题汇总表列表
     */
    @Override
    public List<KthzVo> selectKthz(KthzVo kthzVo) {
        String nf = kthzVo.getNf();
        String xmDeptId = kthzVo.getXmDeptId();
        String xmName = kthzVo.getXmName();
        String xmBh = kthzVo.getXmBh();

        // 构造月份列表
        List<Integer> months = IntStream.rangeClosed(1, 12).boxed().collect(Collectors.toList());

        return kthzMapper.selectKthz(nf, xmDeptId, xmName, xmBh, months);
    }
}
